package com.xtaller.rwdb.controller;

import com.xtaller.rwdb.model.User;
import com.xtaller.rwdb.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Taller
 * @create 2018-03-20 16:16
 */
@RestController
@RequestMapping(value = "/user")
public class UserController {
    @Autowired
    private IUserService userService;

    @GetMapping(value = "/list")
    public Object get(){
        return userService.selectById(9001);
    }

    @GetMapping(value = "/list2/{id}")
    public Object geta(@PathVariable("id") String id){
        User u = new User();
        u.setId(id);
        u.setLoginName("xxxxx"+id);
        u.setSalt(1);

        userService.insert(u);
        return userService.selectById(9009);
    }

}
